<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Adds non-existent function or method</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.uopz-add-function" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">uopz_add_function</h1>
  <p class="verinfo">(PECL uopz 5)</p><p class="refpurpose"><span class="refname">uopz_add_function</span> &mdash; <span class="dc-title">Adds non-existent function or method</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.uopz-add-function-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>uopz_add_function</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$function</code></span>
   , <span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$handler</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$flags</code><span class="initializer"> = ZEND_ACC_PUBLIC</span></span>
  ] ) : <span class="type">bool</span></div>

  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>uopz_add_function</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$function</code></span>
   , <span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$handler</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$flags</code><span class="initializer"> = ZEND_ACC_PUBLIC</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$all</code><span class="initializer"> = <strong><code>TRUE</code></strong></span></span>
  ]] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Adds a non-existent function or method.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.uopz-add-function-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">class</code></dt>

    <dd>

     <p class="para">
      The name of the class.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">function</code></dt>

    <dd>

     <p class="para">
      The name of the function or method.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">handler</code></dt>

    <dd>

     <p class="para">
      The <a href="class.closure.html" class="classname">Closure</a> that defines the new function or method.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">flags</code></dt>

    <dd>

     <p class="para">
      Flags to set for the new function or method.
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">all</code></dt>

    <dd>

     <p class="para">
      Whether all classes that descend from <code class="parameter">class</code> will
      also be affected.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.uopz-add-function-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.uopz-add-function-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   <span class="function"><strong>uopz_add_function()</strong></span> throws a <a href="class.runtimeexception.html" class="classname">RuntimeException</a>
   if the function or method to add already exists.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.uopz-add-function-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-561">
   <p><strong>Example #1 Basic <span class="function"><strong>uopz_add_function()</strong></span> Usage</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />uopz_add_function</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">,&nbsp;function&nbsp;()&nbsp;{echo&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">;});<br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
   </div>

   <div class="example-contents"><p>以上例程会输出：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
bar
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.uopz-add-function-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="uopz_del_function.html" class="function" rel="rdfs-seeAlso">uopz_del_function()</a> - Deletes previously added function or method</span></li>
   <li class="member"><span class="function"><a href="uopz_set_return.html" class="function" rel="rdfs-seeAlso">uopz_set_return()</a> - Provide a return value for an existing function</span></li>
  </ul>
 </div>


</div></div></div></body></html>